package com.anran.passenger.controller;

import com.anran.common.constant.ApplicationNameConstants;
import com.anran.common.response.ResponseResult;

import com.anran.passenger.remote.OnlineServiceVerificationCodeClient;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;


@RestController
@RequestMapping(ApplicationNameConstants.ONLINE_API_PASSENGER)
public class TestPassenger {

    final static Logger logger = LoggerFactory.getLogger(TestPassenger.class);

    @Resource
    private OnlineServiceVerificationCodeClient onlineServiceVerificationCodeClient;


    @GetMapping("/numberCode/{size}")
    public ResponseResult Test(@PathVariable("size") int size){
        try {
            ResponseResult result = onlineServiceVerificationCodeClient.numberCode(size);
            return result;
        } catch (Exception e) {
            logger.error("获取验证码错误：{}", e);
            return ResponseResult.fail("获取验证码错误");
        }
    }
}
